package aliyunOss

import (
	"fmt"
	openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
	facebody "github.com/alibabacloud-go/facebody-20191230/v3/client"
	util "github.com/alibabacloud-go/tea-utils/v2/service"
)

func main() {
	config := new(openapi.Config)

	// 使用 ak 初始化 config
	config.SetAccessKeyId("ACCESS_KEY_ID").
		SetAccessKeySecret("ACCESS_KEY_SECRET").
		SetRegionId("cn-shanghai").
		SetEndpoint("facebody.cn-shanghai.aliyuncs.com")

	// 创建客户端
	client, err := facebody.NewClient(config)
	if err != nil {
		panic(err)
	}

	// 初始化 runtimeObject
	runtimeObject := new(util.RuntimeOptions).SetAutoretry(false).SetMaxIdleConns(3)

	// 初始化 request
	request := new(facebody.DetectFaceRequest)

	// 调用 api
	resp, err := client.DetectFaceWithOptions(request, runtimeObject)
	if err != nil {
		fmt.Println(err.Error())
	}
	fmt.Println(resp)
}
